@echo on

echo set CAMINHO=%1
set CAMINHO=%1

echo set VERSAO=%2
set VERSAO=%2

echo set BRANCH=%3
set BRANCH=%3

echo set BRANCH=%3
set BRANCH=%3

echo set SERVIDOR=%4
set SERVIDOR=%4

echo set TF=%5
set TF=%5

echo set FOLDER=%6
set FOLDER=%6

echo set UNIDADE=%7
set UNIDADE=%7

echo md \%FOLDER%
md \%FOLDER%

echo cd \%FOLDER%
cd \%FOLDER%

echo %TF% workspace /server:%SERVIDOR% /new work_space_temp_pse /noprompt
%TF% workspace /server:%SERVIDOR% /new work_space_temp_pse /noprompt

echo %TF% branch %CAMINHO%/Compilados/Deployment $/PSE/Setup/%BRANCH%/%VERSAO%/x86 /version:T
%TF% branch %CAMINHO%/Compilados/Deployment $/PSE/Setup/%BRANCH%/%VERSAO%/x86 /version:T

echo %TF% branch %CAMINHO%/Compilados/Certificates $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Certificates /version:T /noget
%TF% branch %CAMINHO%/Compilados/Certificates $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Certificates /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Framework $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Framework /version:T /noget
%TF% branch %CAMINHO%/Compilados/Framework $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Framework /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/Settings $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Settings /version:T /noget
%TF% branch %CAMINHO%/Compilados/Settings $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Settings /version:T /noget

echo %TF% branch %CAMINHO%/Compilados/GeneralSettings.config $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/GeneralSettings.config /version:T /noget
%TF% branch %CAMINHO%/Compilados/GeneralSettings.config $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/GeneralSettings.config /version:T /noget

echo %TF% undo $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Settings/GeneralSettings.config
%TF% undo $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Bin/PSE/Settings/GeneralSettings.config

echo %TF% undo $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Manager /recursive
%TF% undo $/PSE/Setup/%BRANCH%/%VERSAO%/x86/Manager /recursive

echo %TF% undo $/PSE/Setup/%BRANCH%/%VERSAO%/x86/TeamFoundation /recursive
%TF% undo $/PSE/Setup/%BRANCH%/%VERSAO%/x86/TeamFoundation /recursive

echo %UNIDADE%:\%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\x86\SetupGenerator.exe %VERSAO% %UNIDADE%:\%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\x86\
%UNIDADE%:\%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\x86\SetupGenerator.exe %VERSAO% %UNIDADE%:\%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\x86\

echo %TF% add %UNIDADE%:\%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\x86\SetupConfiguration.xml
%TF% add %UNIDADE%:\%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\x86\SetupConfiguration.xml

echo %TF% checkin /comment:"Montagem do Setup da PSE da versao %VERSAO%" /notes:"Codigo Aprovado"="_svctfs" /override:"Montagem do Setup da PSE da versao %VERSAO%" /recursive /noprompt
%TF% checkin /comment:"Montagem do Setup da PSE da versao %VERSAO%" /notes:"Codigo Aprovado"="_svctfs" /override:"Montagem do Setup da PSE da versao %VERSAO%" /recursive /noprompt

echo %TF% workspace /server:%SERVIDOR% /delete /noprompt work_space_temp_pse
%TF% workspace /server:%SERVIDOR% /delete /noprompt work_space_temp_pse

echo rd \%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\ /s /q
rd \%FOLDER%\PSE\Setup\%BRANCH%\%VERSAO%\ /s /q